<?php

/**
 * Created by PhpStorm.
 * User: Leen
 * Date: 2016/1/4
 * Time: 15:57
 */
namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UpdateAddressRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * 验证规则
     *
     * @return array
     */
    public function rules()
    {
        $rules =  [
            'consignee' => 'max:60',
            'country' => 'max:60',
            'province' => 'max:60',
            'city' => 'max:60',
            'district' => 'max:120',
            'address' => 'max:120',
            'mobile' => 'size:11',
            'is_default' => 'in:0,1',
        ];
        return $rules;

    }

    /**
     * 验证信息
     * @return array
     */

    public function messages()
    {
        return [


            'consignee.max'  => '收货人最大长度为60个字符',

            'country.max'=>'国家最大长度为60个字符',

            'province.max'=>'省份最大长度为60个字符',

            'city.max'=>'城市最大长度为60个字符',

            'district.max'=>'街道最大长度为120个字符',

            'address.max'=>'详细地址最大长度为120个字符',

            'mobile.size'  => '手机号码必须是11位',

            'is_default.in'  => '默认地址的值不正确',
        ];
    }
}